const request = require("../utils/request")
// 获取商品分类的数据

function getGoodsClass() {
  // 小程序必须这样写
  return request({
    url: '/api/getgoodsclass',
    method:"post",
    

  })
}

 
function gouwu(data) {
  // 小程序必须这样写
  console.log('111')
  console.log( wx.getStorageSync('userInfo'))
  return request({
    url: '/api/getGouWUChe',
    method:"post",
    data:{
      openid:wx.getStorageSync('userInfo').openId
    }
  })
}

function getMiaoSha(data){
  return request({
    url:"/api/management",
    method:"post",
    data:data
  })
}

function getGropData(data){
  return request({
    url:"/api/group",
    method:"post",
    data:data
  })
}
// 秒杀商品详情
function getMiaoShaInfo(data){
  return request({
    url:"/api/miaoshainfo",
    method:"post",
    data:data
  })
}
// 添加购物车
function getaddXiang(data){
  console.log(data,'data');
  return request({
    url:"/api/addXiang",
    method:"post",
    data:{
      shopid:data.id,
      merchantId:"123",
      title:data.title,
      image:data.img,
      quantity:data.limited,
      price:data.Original,
      name:data.Seconds,
      shopnum:"1000",
      shopimg:data.allocation,
      shopntitle:data.introduce,
      hasSelected:"false",
      quantityUpdatable:"false",
      hasAllSelected:"false",
      isCartEmpty:"false",
      isActivity:"true",
      openid:wx.getStorageSync('userInfo').openId
    }
  })
}


module.exports = {
  getMiaoSha,
  getGropData,
  gouwu,
  getGoodsClass,
  getMiaoShaInfo,
  getaddXiang
}